from pydantic import BaseModel, Field
from typing import Optional
from fastapiApp.models.enums import StationType, AGVStatus

class BaseMapNode(BaseModel):
    """
    站点基本信息模型
    """
    name: str = Field(..., description="站点名称")
    type: StationType = Field(..., description="站点类型")
    status: AGVStatus = Field(..., description="站点状态")
    x: int = Field(..., ge=0, le=10000, description="X坐标百分比位置")
    y: int = Field(..., ge=0, le=10000, description="Y坐标百分比位置")
    description: Optional[str] = Field(None, description="站点描述")

class MapNodeCreate(BaseMapNode):
    """
    创建站点请求模型
    """
    pass

class MapNodeUpdate(BaseMapNode):
    """
    更新站点请求模型
    """
    id: int

class MapEdgeCreate(BaseModel):
    """
    创建地图边请求模型
    """
    node_from: int = Field(..., description="起始节点ID")
    node_to: int = Field(..., description="目标节点ID")
    weight: int = Field(1, description="权重")
    occupied: int = Field(0, description="是否被占用")
    distance: int = Field(0, description="距离")
    description: str = Field(None, description="边描述")
